<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

 if(request.getAttribute("error")!=null){
	out.println(request.getAttribute("error").toString());
	}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>insert_how</title>
    <link href="../style/main.css" rel="stylesheet" type="text/css" />
    <link href="../style/ZuCe.css" rel="stylesheet" type="text/css" />
    <link href="../style/table.css" rel="stylesheet" type="text/css" />
		<script language=JavaScript>
		var flag=false;
		function DrawImage(ImgD){
		   var image=new Image();
		   image.src=ImgD.src;
		   if(image.width>0 && image.height>0){
		    flag=true;
		    if(image.width/image.height>= 120/80){
		     if(image.width>120){  
		     ImgD.width=120;
		     ImgD.height=(image.height*120)/image.width;
		     }else{
		     ImgD.width=image.width;  
		     ImgD.height=image.height;
		     }
		     ImgD.alt=image.width+"*"+image.height;
		     }
		    else{
		     if(image.height>80){  
		     ImgD.height=80;
		     ImgD.width=(image.width*80)/image.height;     
		     }else{
		     ImgD.width=image.width;  
		     ImgD.height=image.height;
		     }
		     ImgD.alt=image.width+"*"+image.height;
		     }
		    }
		   /*else{
		    ImgD.src="";
		    ImgD.alt=""
		    }*/
		   } 
		
		function FileChange(Value){
		flag=false;
		document.all.uploadimage.width=10;
		document.all.uploadimage.height=10;
		document.all.uploadimage.alt="";
		document.all.uploadimage.src=Value;
		}
		
		function BeforeUpLoad(){
		if(flag) alert("OK");else alert("FAIL");
		}
		</script>
 </head>
  <body style="text-align:center">
		<div class="MainTop"><img src="../images/maintopright.gif" /></div>
	    <div class="MainBar">
	    	<p style="text-indent:2em; text-align:left"> 你现在的位置: > >上传作品</p>
	    </div>
    	<form action="showWorkAction.do?method=insertShow" method="post" enctype="multipart/form-data">
			<div id="container">
				<div id="content">
					<table cellspacing="0" cellpadding="0">
						<tr>
							<td rowspan="2" width="200px"><IMG id=uploadimage height=10 width=10 src=""  onload="javascript:DrawImage(this);" ></td>
							<td>作品名称:</td>
							<td><input name="show_name" type="text" class="InputStyle"/></td>
						</tr>
						<tr>
							<td>上传时间:</td>
							<td><input name="show_time" type="text" class="InputStyle" /></td>
						</tr>			
						<tr>
						 
			 			 <td colspan="3" style="text-align:left;text-indent:0.5em;">请选择上传的图片: <input type="file" name="file" size="50" onchange="javascript:FileChange(this.value);"/></td>
					  </tr>
						<tr>
						  <td colspan="3" style="text-align:left;text-indent:0.5em;">作品简介:</td>
					  </tr>
						<tr>
						  <td colspan="3"><textarea name="show_content" id="textarea" cols="80" rows="5"></textarea></td>
					  </tr>
						<tr>
							<td colspan="3" class="ZuCe"><input type="image" src="../images/upload.gif" alt="上传" /></td>
						</tr>			
																						
					</table>
				</div>
			</div>
		</form>
  </body>
</html>
